package easycloud.ecs.common.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import easycloud.ecs.common.domain.Item;
import easycloud.ecs.common.domain.Provider;

public interface ItemRepository extends JpaRepository<Item, Integer> {

	@Query("select i from Item i, Sync s where i.path = :path and s.provider = :provider and i.folder = s.folder")
	Item findByPath(@Param("path") String path,
			@Param("provider") Provider provider);

	@Query("select i from Item i, Sync s where s.provider = :provider and i.folder = s.folder")
	List<Item> findByProvider(@Param("provider") Provider provider);
}
